﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ASPDotNetSamples;
using com.paypal.soap.api;

public partial class Admin_GetBalance : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            UserName.Text = Constants.API_USERNAME;
            Password.Text = Constants.API_PASSWORD;
            Signature.Text = Constants.API_SIGNATURE;
            this.DataBind();
        }
    }
    public override void DataBind()
    {
        Global.is3token = true;
        Session["stage"] = "SandBox";
        SetProfile.SessionProfile = SetProfile.CreateAPIProfile(Constants.API_USERNAME, Constants.API_PASSWORD, Constants.API_SIGNATURE, "", "", "", "", "SandBox", "");
        PayPalAPI api = new PayPalAPI();
        this.PayPalResponse = api.GetBalance();
        if (this.PayPalResponse.Ack == AckCodeType.Failure)
        {
           //this.Response.Redirect("GetBalanceResponse.aspx");
        }
        else
        {
            AmountIdentifier.Text = ((GetBalanceResponseType)this.PayPalResponse).Balance.Value;
            CurrencyIdentifier.Text = ((GetBalanceResponseType)this.PayPalResponse).Balance.currencyID.ToString() ;
           // this.Response.Redirect("GetBalanceResponse.aspx?" + "Amount" + "=" + ((GetBalanceResponseType)this.PayPalResponse).Balance.Value + "&currencyid=" + ((GetBalanceResponseType)this.PayPalResponse).Balance.currencyID);
        }


    }
    protected GetBalanceResponseType Result
    {
        get
        {
            return (GetBalanceResponseType)this.PayPalResponse;
        }
    }
}
